<?
/**
 * Main.php
 *
 * This is an example of the main page of a website. Here
 * users will be able to login. However, like on most sites
 * the login form doesn't just have to be on the main page,
 * but re-appear on subsequent pages, depending on whether
 * the user has logged in or not.
 *
 */
include("include/session.php");
?>

<?
if($session->logged_in){
   $userPoints = $database->getUserPoints($session->username);
   echo "<h1> Welcome <b>$session->username</b> </h1>"
       ."<h2>you have: </br> $userPoints QRedits</h2>"
       ."[<a href=\"useredit.php\">Edit Account</a>]";
   if($session->isAdmin()){
      echo "</br>[<a href=\"admin/admin.php\">Admin Center</a>]";
   }
   echo "</br>[<a href=\"process.php\">Logout</a>]";
   
}
else{
?>
 You are not logged in -- redirecting to log-in page
<script type = "text/javascript"> top.window.location = 'http://localhost/www/main.php'; </script>

<?
}

if(isset($_GET['clue'])){
    echo $_GET['clue'];
}

?>
Congratulations you completed the scavenger hunt!

<?

$database->addUserPoints($Session->username,20);
?>

Your total amount of points are: 
<? 
$userPoints = $database->getUserPoints($Session->username);
?>